Accelerated erasure coding system and method

ABSTRACT

An accelerated erasure coding system includes a processing core for executing computer instructions and accessing data from a main memory, and a non-volatile storage medium for storing the computer instructions. The processing core, storage medium, and computer instructions are configured to implement an erasure coding system, which includes: a data matrix for holding original data in the main memory; a check matrix for holding check data in the main memory; an encoding matrix for holding first factors in the main memory, the first factors being for encoding the original data into the check data; and a thread for executing on the processing core. The thread includes: a parallel multiplier for concurrently multiplying multiple entries of the data matrix by a single entry of the encoding matrix; and a first sequencer for ordering operations through the data matrix and the encoding matrix using the parallel multiplier to generate the check data.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.15/976,175 filed May 10, 2018, which is a continuation of U.S. patentapplication Ser. No. 15/201,196, filed on Jul. 1, 2016, now U.S. Pat.No. 10,003,358, issued on Jun. 19, 2018, which is a continuation of U.S.patent application Ser. No. 14/852,438, filed on Sep. 11, 2015, now U.S.Pat. No. 9,385,759, issued on Jul. 5, 2016, which is a continuation ofU.S. patent application Ser. No. 14/223,740, filed on Mar. 24, 2014, nowU.S. Pat. No. 9,160,374, issued on Oct. 13, 2015, which is acontinuation of U.S. patent application Ser. No. 13/341,833, filed onDec. 30, 2011, now U.S. Pat. No. 8,683,296, issued on Mar. 25, 2014, theentire contents of each of which are expressly incorporated herein byreference.

BACKGROUND Field

Aspects of embodiments of the present invention are directed toward anaccelerated erasure coding system and method.

Description of Related Art

An erasure code is a type of error-correcting code (ECC) useful forforward error-correction in applications like a redundant array ofindependent disks (RAID) or high-speed communication systems. In atypical erasure code, data (or original data) is organized in stripes,each of which is broken up into N equal-sized blocks, or data blocks,for some positive integer N. The data for each stripe is thusreconstructable by putting the N data blocks together. However, tohandle situations where one or more of the original N data blocks getslost, erasure codes also encode an additional M equal-sized blocks(called check blocks or check data) from the original N data blocks, forsome positive integer M.

The N data blocks and the M check blocks are all the same size.Accordingly, there are a total of N+M equal-sized blocks after encoding.The N+M blocks may, for example, be transmitted to a receiver as N+Mseparate packets, or written to N+M corresponding disk drives. For easeof description, all N+M blocks after encoding will be referred to asencoded blocks, though some (for example, N of them) may containunencoded portions of the original data. That is, the encoded datarefers to the original data together with the check data.

The M check blocks build redundancy into the system, in a very efficientmanner, in that the original data (as well as any lost check data) canbe reconstructed if any N of the N+M encoded blocks are received by thereceiver, or if any N of the N+M disk drives are functioning correctly.Note that such an erasure code is also referred to as “optimal.” Forease of description, only optimal erasure codes will be discussed inthis application. In such a code, up to M of the encoded blocks can belost, (e.g., up to M of the disk drives can fail) so that if any N ofthe N+M encoded blocks are received successfully by the receiver, theoriginal data (as well as the check data) can be reconstructed. N/(N+M)is thus the code rate of the erasure code encoding (i.e., how much spacethe original data takes up in the encoded data). Erasure codes forselect values of N and M can be implemented on RAID systems employingN+M (disk) drives by spreading the original data among N “data” drives,and using the remaining M drives as “check” drives. Then, when any N ofthe N+M drives are correctly functioning, the original data can bereconstructed, and the check data can be regenerated.

Erasure codes (or more specifically, erasure coding systems) aregenerally regarded as impractical for values of M larger than 1 (e.g.,RAID5 systems, such as parity drive systems) or 2 (RAID6 systems), thatis, for more than one or two check drives. For example, see H. PeterAnvin, “The mathematics of RAID-6,” the entire content of which isincorporated herein by reference, p. 7, “Thus, in 2-disk-degraded mode,performance will be very slow. However, it is expected that that will bea rare occurrence, and that performance will not matter significantly inthat case.” See also Robert Maddock et al., “Surviving Two DiskFailures,” p. 6, “The main difficulty with this technique is thatcalculating the check codes, and reconstructing data after failures, isquite complex. It involves polynomials and thus multiplication, andrequires special hardware, or at least a signal processor, to do it atsufficient speed.” In addition, see also James S. Plank, “All AboutErasure Codes:—Reed-Solomon Coding—LDPC Coding,” slide 15 (describingcomputational complexity of Reed-Solomon decoding), “Bottom line: When n& m grow, it is brutally expensive.” Accordingly, there appears to be ageneral consensus among experts in the field that erasure coding systemsare impractical for RAID systems for all but small values of M (that is,small numbers of check drives), such as 1 or 2.

Modern disk drives, on the other hand, are much less reliable than thoseenvisioned when RAID was proposed. This is due to their capacity growingout of proportion to their reliability. Accordingly, systems with only asingle check disk have, for the most part, been discontinued in favor ofsystems with two check disks.

In terms of reliability, a higher check disk count is clearly moredesirable than a lower check disk count. If the count of error events ondifferent drives is larger than the check disk count, data may be lostand that cannot be reconstructed from the correctly functioning drives.Error events extend well beyond the traditional measure of advertisedmean time between failures (MTBF). A simple, real world example is aservice event on a RAID system where the operator mistakenly replacesthe wrong drive or, worse yet, replaces a good drive with a brokendrive. In the absence of any generally accepted methodology to train,certify, and measure the effectiveness of service technicians, thesetypes of events occur at an unknown rate, but certainly occur. Thefoolproof solution for protecting data in the face of multiple errorevents is to increase the check disk count.

SUMMARY

Aspects of embodiments of the present invention address these problemsby providing a practical erasure coding system that, for byte-level RAIDprocessing (where each byte is made up of 8 bits), performs well evenfor values of N+M as large as 256 drives (for example, N=127 data drivesand M=129 check drives). Further aspects provide for a singleprecomputed encoding matrix (or master encoding matrix) S of sizeM_(max)×N_(max), or (N_(max)+M_(max))×N_(max) or (M_(max)−1)×N_(max),elements (e.g., bytes), which can be used, for example, for anycombination of N≤N_(max) data drives and M≤M_(max) check drives suchthat N_(max)+M_(max)≤256 (e.g., N_(max)=127 and M_(max)=129, orN_(max)=63 and M_(max)=193). This is an improvement over prior artsolutions that rebuild such matrices from scratch every time N or Mchanges (such as adding another check drive). Still higher values of Nand M are possible with larger processing increments, such as 2 bytes,which affords up to N+M=65,536 drives (such as N=32,767 data drives andM=32,769 check drives).

Higher check disk count can offer increased reliability and decreasedcost. The higher reliability comes from factors such as the ability towithstand more drive failures. The decreased cost arises from factorssuch as the ability to create larger groups of data drives. For example,systems with two checks disks are typically limited to group sizes of 10or fewer drives for reliability reasons. With a higher check disk count,larger groups are available, which can lead to fewer overall componentsfor the same unit of storage and hence, lower cost.

Additional aspects of embodiments of the present invention furtheraddress these problems by providing a standard parity drive as part ofthe encoding matrix. For instance, aspects provide for a parity drivefor configurations with up to 127 data drives and up to 128 (non-parity)check drives, for a total of up to 256 total drives including the paritydrive. Further aspects provide for different breakdowns, such as up to63 data drives, a parity drive, and up to 192 (non-parity) check drives.Providing a parity drive offers performance comparable to RAID5 incomparable circumstances (such as single data drive failures) while alsobeing able to tolerate significantly larger numbers of data drivefailures by including additional (non-parity) check drives.

Further aspects are directed to a system and method for implementing afast solution matrix algorithm for Reed-Solomon codes. While knownsolution matrix algorithms compute an N×N solution matrix (see, forexample, J. S. Plank, “A tutorial on Reed-Solomon coding forfault-tolerance in RAID-like systems,” Software—Practice & Experience,27(9):995-1012, September 1997, and J. S. Plank and Y. Ding, “Note:Correction to the 1997 tutorial on Reed-Solomon coding,” TechnicalReport CS-03-504, University of Tennessee, April 2003), requiring O(N³)operations, regardless of the number of failed data drives, aspects ofembodiments of the present invention compute only an F×F solutionmatrix, where F is the number of failed data drives. The overhead forcomputing this F×F solution matrix is approximately F³/3 multiplicationoperations and the same number of addition operations. Not only is F≤N,in almost any practical application, the number of failed data drives Fis considerably smaller than the number of data drives N. Accordingly,the fast solution matrix algorithm is considerably faster than any knownapproach for practical values of F and N.

Still further aspects are directed toward fast implementations of thecheck data generation and the lost (original and check) datareconstruction. Some of these aspects are directed toward fetching thesurviving (original and check) data a minimum number of times (that is,at most once) to carry out the data reconstruction. Some of theseaspects are directed toward efficient implementations that can maximizeor significantly leverage the available parallel processing power ofmultiple cores working concurrently on the check data generation and thelost data reconstruction. Existing implementations do not attempt toaccelerate these aspects of the data generation and thus fail to achievea comparable level of performance.

In an exemplary embodiment of the present invention, a system foraccelerated error-correcting code (ECC) processing is provided. Thesystem includes a processing core for executing computer instructionsand accessing data from a main memory; and a non-volatile storage medium(for example, a disk drive, or flash memory) for storing the computerinstructions. The processing core, the storage medium, and the computerinstructions are configured to implement an erasure coding system. Theerasure coding system includes a data matrix for holding original datain the main memory, a check matrix for holding check data in the mainmemory, an encoding matrix for holding first factors in the main memory,and a thread for executing on the processing core. The first factors arefor encoding the original data into the check data. The thread includesa parallel multiplier for concurrently multiplying multiple data entriesof a matrix by a single factor; and a first sequencer for orderingoperations through the data matrix and the encoding matrix using theparallel multiplier to generate the check data.

The first sequencer may be configured to access each entry of the datamatrix from the main memory at most once while generating the checkdata.

The processing core may include a plurality of processing cores. Thethread may include a plurality of threads. The erasure coding system mayfurther include a scheduler for generating the check data by dividingthe data matrix into a plurality of data matrices, dividing the checkmatrix into a plurality of check matrices, assigning corresponding onesof the data matrices and the check matrices to the threads, andassigning the threads to the processing cores to concurrently generateportions of the check data corresponding to the check matrices fromrespective ones of the data matrices.

The data matrix may include a first number of rows. The check matrix mayinclude a second number of rows. The encoding matrix may include thesecond number of rows and the first number of columns.

The data matrix may be configured to add rows to the first number ofrows or the check matrix may be configured to add rows to the secondnumber of rows while the first factors remain unchanged.

Each of entries of one of the rows of the encoding matrix may include amultiplicative identity factor (such as 1).

The data matrix may be configured to be divided by rows into a survivingdata matrix for holding surviving original data of the original data,and a lost data matrix corresponding to lost original data of theoriginal data and including a third number of rows. The erasure codingsystem may further include a solution matrix for holding second factorsin the main memory. The second factors are for decoding the check datainto the lost original data using the surviving original data and thefirst factors.

The solution matrix may include the third number of rows and the thirdnumber of columns.

The solution matrix may further include an inverted said third number bysaid third number sub-matrix of the encoding matrix.

The erasure coding system may further include a first list of rows ofthe data matrix corresponding to the surviving data matrix, and a secondlist of rows of the data matrix corresponding to the lost data matrix.

The data matrix may be configured to be divided into a surviving datamatrix for holding surviving original data of the original data, and alost data matrix corresponding to lost original data of the originaldata. The erasure coding system may further include a solution matrixfor holding second factors in the main memory. The second factors arefor decoding the check data into the lost original data using thesurviving original data and the first factors. The thread may furtherinclude a second sequencer for ordering operations through the survivingdata matrix, the encoding matrix, the check matrix, and the solutionmatrix using the parallel multiplier to reconstruct the lost originaldata.

The second sequencer may be further configured to access each entry ofthe surviving data matrix from the main memory at most once whilereconstructing the lost original data.

The processing core may include a plurality of processing cores. Thethread may include a plurality of threads. The erasure coding system mayfurther include: a scheduler for generating the check data andreconstructing the lost original data by dividing the data matrix into aplurality of data matrices; dividing the surviving data matrix into aplurality of surviving data matrices; dividing the lost data matrix intoa plurality of lost data matrices; dividing the check matrix into aplurality of check matrices; assigning corresponding ones of the datamatrices, the surviving data matrices, the lost data matrices, and thecheck matrices to the threads; and assigning the threads to theprocessing cores to concurrently generate portions of the check datacorresponding to the check matrices from respective ones of the datamatrices and to concurrently reconstruct portions of the lost originaldata corresponding to the lost data matrices from respective ones of thesurviving data matrices and the check matrices.

The check matrix may be configured to be divided into a surviving checkmatrix for holding surviving check data of the check data, and a lostcheck matrix corresponding to lost check data of the check data. Thesecond sequencer may be configured to order operations through thesurviving data matrix, the reconstructed lost original data, and theencoding matrix using the parallel multiplier to regenerate the lostcheck data.

The second sequencer may be further configured to reconstruct the lostoriginal data concurrently with regenerating the lost check data.

The second sequencer may be further configured to access each entry ofthe surviving data matrix from the main memory at most once whilereconstructing the lost original data and regenerating the lost checkdata.

The second sequencer may be further configured to regenerate the lostcheck data without accessing the reconstructed lost original data fromthe main memory.

The processing core may include a plurality of processing cores. Thethread may include a plurality of threads. The erasure coding system mayfurther include a scheduler for generating the check data,reconstructing the lost original data, and regenerating the lost checkdata by: dividing the data matrix into a plurality of data matrices;dividing the surviving data matrix into a plurality of surviving datamatrices; dividing the lost data matrix into a plurality of lost datamatrices; dividing the check matrix into a plurality of check matrices;dividing the surviving check matrix into a plurality of surviving checkmatrices; dividing the lost check matrix into a plurality of lost checkmatrices; assigning corresponding ones of the data matrices, thesurviving data matrices, the lost data matrices, the check matrices, thesurviving check matrices, and the lost check matrices to the threads;and assigning the threads to the processing cores to concurrentlygenerate portions of the check data corresponding to the check matricesfrom respective ones of the data matrices, to concurrently reconstructportions of the lost original data corresponding to the lost datamatrices from respective ones of the surviving data matrices and thesurviving check matrices, and to concurrently regenerate portions of thelost check data corresponding to the lost check matrices from respectiveones of the surviving data matrices and respective portions of thereconstructed lost original data.

The processing core may include 16 data registers. Each of the dataregisters may include 16 bytes. The parallel multiplier may beconfigured to process the data in units of at least 64 bytes spread overat least four of the data registers at a time.

Consecutive instructions to process each of the units of the data mayaccess separate ones of the data registers to permit concurrentexecution of the consecutive instructions by the processing core.

The parallel multiplier may include two lookup tables for doingconcurrent multiplication of 4-bit quantities across 16 byte-sizedentries using the PSHUFB (Packed Shuffle Bytes) instruction.

The parallel multiplier may be further configured to receive an inputoperand in four of the data registers, and return with the input operandintact in the four of the data registers.

According to another exemplary embodiment of the present invention, amethod of accelerated error-correcting code (ECC) processing on acomputing system is provided. The computing system includes anon-volatile storage medium (such as a disk drive or flash memory), aprocessing core for accessing instructions and data from a main memory,and a computer program including a plurality of computer instructionsfor implementing an erasure coding system. The method includes: storingthe computer program on the storage medium; executing the computerinstructions on the processing core; arranging original data as a datamatrix in the main memory; arranging first factors as an encoding matrixin the main memory, the first factors being for encoding the originaldata into check data, the check data being arranged as a check matrix inthe main memory; and generating the check data using a parallelmultiplier for concurrently multiplying multiple data entries of amatrix by a single factor. The generating of the check data includesordering operations through the data matrix and the encoding matrixusing the parallel multiplier.

The generating of the check data may include accessing each entry of thedata matrix from the main memory at most once.

The processing core may include a plurality of processing cores. Theexecuting of the computer instructions may include executing thecomputer instructions on the processing cores. The method may furtherinclude scheduling the generating of the check data by: dividing thedata matrix into a plurality of data matrices; dividing the check matrixinto a plurality of check matrices; and assigning corresponding ones ofthe data matrices and the check matrices to the processing cores toconcurrently generate portions of the check data corresponding to thecheck matrices from respective ones of the data matrices.

The method may further include: dividing the data matrix into asurviving data matrix for holding surviving original data of theoriginal data, and a lost data matrix corresponding to lost originaldata of the original data; arranging second factors as a solution matrixin the main memory, the second factors being for decoding the check datainto the lost original data using the surviving original data and thefirst factors; and reconstructing the lost original data by orderingoperations through the surviving data matrix, the encoding matrix, thecheck matrix, and the solution matrix using the parallel multiplier.

The reconstructing of the lost original data may include accessing eachentry of the surviving data matrix from the main memory at most once.

The processing core may include a plurality of processing cores. Theexecuting of the computer instructions may include executing thecomputer instructions on the processing cores. The method may furtherinclude scheduling the generating of the check data and thereconstructing of the lost original data by: dividing the data matrixinto a plurality of data matrices; dividing the surviving data matrixinto a plurality of surviving data matrices; dividing the lost datamatrix into a plurality of lost data matrices; dividing the check matrixinto a plurality of check matrices; and assigning corresponding ones ofthe data matrices, the surviving data matrices, the lost data matrices,and the check matrices to the processing cores to concurrently generateportions of the check data corresponding to the check matrices fromrespective ones of the data matrices and to concurrently reconstructportions of the lost original data corresponding to the lost datamatrices from respective ones of the surviving data matrices and thecheck matrices.

The method may further include: dividing the check matrix into asurviving check matrix for holding surviving check data of the checkdata, and a lost check matrix corresponding to lost check data of thecheck data; and regenerating the lost check data by ordering operationsthrough the surviving data matrix, the reconstructed lost original data,and the encoding matrix using the parallel multiplier.

The reconstructing of the lost original data may take place concurrentlywith the regenerating of the lost check data.

The reconstructing of the lost original data and the regenerating of thelost check data may include accessing each entry of the surviving datamatrix from the main memory at most once.

The regenerating of the lost check data may take place without accessingthe reconstructed lost original data from the main memory.

The processing core may include a plurality of processing cores. Theexecuting of the computer instructions may include executing thecomputer instructions on the processing cores. The method may furtherinclude scheduling the generating of the check data, the reconstructingof the lost original data, and the regenerating of the lost check databy: dividing the data matrix into a plurality of data matrices; dividingthe surviving data matrix into a plurality of surviving data matrices;dividing the lost data matrix into a plurality of lost data matrices;dividing the check matrix into a plurality of check matrices; dividingthe surviving check matrix into a plurality of surviving check matrices;dividing the lost check matrix into a plurality of lost check matrices;and assigning corresponding ones of the data matrices, the survivingdata matrices, the lost data matrices, the check matrices, the survivingcheck matrices, and the lost check matrices to the processing cores toconcurrently generate portions of the check data corresponding to thecheck matrices from respective ones of the data matrices, toconcurrently reconstruct portions of the lost original datacorresponding to the lost data matrices from respective ones of thesurviving data matrices and the surviving check matrices, and toconcurrently regenerate portions of the lost check data corresponding tothe lost check matrices from respective ones of the surviving datamatrices and respective portions of the reconstructed lost originaldata.

According to yet another exemplary embodiment of the present invention,a non-transitory computer-readable storage medium (such as a disk drive,a compact disk (CD), a digital video disk (DVD), flash memory, auniversal serial bus (USB) drive, etc.) containing a computer programincluding a plurality of computer instructions for performingaccelerated error-correcting code (ECC) processing on a computing systemis provided. The computing system includes a processing core foraccessing instructions and data from a main memory. The computerinstructions are configured to implement an erasure coding system whenexecuted on the computing system by performing the steps of: arrangingoriginal data as a data matrix in the main memory; arranging firstfactors as an encoding matrix in the main memory, the first factorsbeing for encoding the original data into check data, the check databeing arranged as a check matrix in the main memory; and generating thecheck data using a parallel multiplier for concurrently multiplyingmultiple data entries of a matrix by a single factor. The generating ofthe check data includes ordering operations through the data matrix andthe encoding matrix using the parallel multiplier.

The generating of the check data may include accessing each entry of thedata matrix from the main memory at most once.

The processing core may include a plurality of processing cores. Thecomputer instructions may be further configured to perform the step ofscheduling the generating of the check data by: dividing the data matrixinto a plurality of data matrices; dividing the check matrix into aplurality of check matrices; and assigning corresponding ones of thedata matrices and the check matrices to the processing cores toconcurrently generate portions of the check data corresponding to thecheck matrices from respective ones of the data matrices.

The computer instructions may be further configured to perform the stepsof: dividing the data matrix into a surviving data matrix for holdingsurviving original data of the original data, and a lost data matrixcorresponding to lost original data of the original data; arrangingsecond factors as a solution matrix in the main memory, the secondfactors being for decoding the check data into the lost original datausing the surviving original data and the first factors; andreconstructing the lost original data by ordering operations through thesurviving data matrix, the encoding matrix, the check matrix, and thesolution matrix using the parallel multiplier.

The computer instructions may be further configured to perform the stepsof: dividing the check matrix into a surviving check matrix for holdingsurviving check data of the check data, and a lost check matrixcorresponding to lost check data of the check data; and regenerating thelost check data by ordering operations through the surviving datamatrix, the reconstructed lost original data, and the encoding matrixusing the parallel multiplier.

The reconstructing of the lost original data and the regenerating of thelost check data may include accessing each entry of the surviving datamatrix from the main memory at most once.

The processing core may include a plurality of processing cores. Thecomputer instructions may be further configured to perform the step ofscheduling the generating of the check data, the reconstructing of thelost original data, and the regenerating of the lost check data by:dividing the data matrix into a plurality of data matrices; dividing thesurviving data matrix into a plurality of surviving data matrices;dividing the lost data matrix into a plurality of lost data matrices;dividing the check matrix into a plurality of check matrices; dividingthe surviving check matrix into a plurality of surviving check matrices;dividing the lost check matrix into a plurality of lost check matrices;and assigning corresponding ones of the data matrices, the survivingdata matrices, the lost data matrices, the check matrices, the survivingcheck matrices, and the lost check matrices to the processing cores toconcurrently generate portions of the check data corresponding to thecheck matrices from respective ones of the data matrices, toconcurrently reconstruct portions of the lost original datacorresponding to the lost data matrices from respective ones of thesurviving data matrices and the surviving check matrices, and toconcurrently regenerate portions of the lost check data corresponding tothe lost check matrices from respective ones of the surviving datamatrices and respective portions of the reconstructed lost originaldata.

By providing practical and efficient systems and methods for erasurecoding systems (which for byte-level processing can support up toN+M=256 drives, such as N=127 data drives and M=129 check drives,including a parity drive), applications such as RAID systems that cantolerate far more failing drives than was thought to be possible orpractical can be implemented with accelerated performance significantlybetter than any prior art solution.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings, together with the specification, illustrateexemplary embodiments of the present invention and, together with thedescription, serve to explain aspects and principles of the presentinvention.

FIG. 1 shows an exemplary stripe of original and check data according toan embodiment of the present invention.

FIG. 2 shows an exemplary method for reconstructing lost data after afailure of one or more drives according to an embodiment of the presentinvention.

FIG. 3 shows an exemplary method for performing a parallel lookup Galoisfield multiplication according to an embodiment of the presentinvention.

FIG. 4 shows an exemplary method for sequencing the parallel lookupmultiplier to perform the check data generation according to anembodiment of the present invention.

FIGS. 5-7 show an exemplary method for sequencing the parallel lookupmultiplier to perform the lost data reconstruction according to anembodiment of the present invention.

FIG. 8 illustrates a multi-core architecture system according to anembodiment of the present invention.

FIG. 9 shows an exemplary disk drive configuration according to anembodiment of the present invention.

DETAILED DESCRIPTION

Hereinafter, exemplary embodiments of the invention will be described inmore detail with reference to the accompanying drawings. In thedrawings, like reference numerals refer to like elements throughout.

While optimal erasure codes have many applications, for ease ofdescription, they will be described in this application with respect toRAID applications, i.e., erasure coding systems for the storage andretrieval of digital data distributed across numerous storage devices(or drives), though the present application is not limited thereto. Forfurther ease of description, the storage devices will be assumed to bedisk drives, though the invention is not limited thereto. In RAIDsystems, the data (or original data) is broken up into stripes, each ofwhich includes N uniformly sized blocks (data blocks), and the N blocksare written across N separate drives (the data drives), one block perdata drive.

In addition, for ease of description, blocks will be assumed to becomposed of L elements, each element having a fixed size, say 8 bits orone byte. An element, such as a byte, forms the fundamental unit ofoperation for the RAID processing, but the invention is just asapplicable to other size elements, such as 16 bits (2 bytes). Forsimplification, unless otherwise indicated, elements will be assumed tobe one byte in size throughout the description that follows, and theterm “element(s)” and “byte(s)” will be used synonymously.

Conceptually, different stripes can distribute their data blocks acrossdifferent combinations of drives, or have different block sizes ornumbers of blocks, etc., but for simplification and ease of descriptionand implementation, the described embodiments in the present applicationassume a consistent block size (L bytes) and distribution of blocksamong the data drives between stripes. Further, all variables, such asthe number of data drives N, will be assumed to be positive integersunless otherwise specified. In addition, since the N=1 case reduces tosimple data mirroring (that is, copying the same data drive multipletimes), it will also be assumed for simplicity that N≥2 throughout.

The N data blocks from each stripe are combined using arithmeticoperations (to be described in more detail below) in M different ways toproduce M blocks of check data (check blocks), and the M check blockswritten across M drives (the check drives) separate from the N datadrives, one block per check drive. These combinations can take place,for example, when new (or changed) data is written to (or back to) disk.Accordingly, each of the N+M drives (data drives and check drives)stores a similar amount of data, namely one block for each stripe. Asthe processing of multiple stripes is conceptually similar to theprocessing of one stripe (only processing multiple blocks per driveinstead of one), it will be further assumed for simplification that thedata being stored or retrieved is only one stripe in size unlessotherwise indicated. It will also be assumed that the block size L issufficiently large that the data can be consistently divided across eachblock to produce subsets of the data that include respective portions ofthe blocks (for efficient concurrent processing by different processingunits).

FIG. 1 shows an exemplary stripe 10 of original and check data accordingto an embodiment of the present invention.

Referring to FIG. 1, the stripe 10 can be thought of not only as theoriginal N data blocks 20 that make up the original data, but also thecorresponding M check blocks 30 generated from the original data (thatis, the stripe 10 represents encoded data). Each of the N data blocks 20is composed of L bytes 25 (labeled byte 1, byte 2, . . . , byte L), andeach of the M check blocks 30 is composed of L bytes 35 (labeledsimilarly). In addition, check drive 1, byte 1, is a linear combinationof data drive 1, byte 1; data drive 2, byte 1; . . . ; data drive N,byte 1. Likewise, check drive 1, byte 2, is generated from the samelinear combination formula as check drive 1, byte 1, only using datadrive 1, byte 2; data drive 2, byte 2; . . . ; data drive N, byte 2. Incontrast, check drive 2, byte 1, uses a different linear combinationformula than check drive 1, byte 1, but applies it to the same data,namely data drive 1, byte 1; data drive 2, byte 1; . . . ; data drive N,byte 1. In this fashion, each of the other check bytes 35 is a linearcombination of the respective bytes of each of the N data drives 20 andusing the corresponding linear combination formula for the particularcheck drive 30.

The stripe 10 in FIG. 1 can also be represented as a matrix C of encodeddata. C has two sub-matrices, namely original data D on top and checkdata Jon bottom. That is,

${C = {\begin{bmatrix}D \\J\end{bmatrix} = \begin{bmatrix}D_{11} & D_{12} & \ldots & D_{1L} \\D_{21} & D_{22} & \ldots & D_{2L} \\\vdots & \vdots & \ddots & \cdots \\D_{N\; 1} & D_{N\; 2} & \ldots & D_{NL} \\J_{11} & J_{12} & \ldots & J_{1L} \\J_{21} & J_{22} & \ldots & J_{2L} \\\vdots & \vdots & \ddots & \vdots \\J_{M\; 1} & J_{M\; 2} & \ldots & J_{ML}\end{bmatrix}}},$

where D_(ij)=byte j from data drive i and J_(ij)=byte j from check drivei. Thus, the rows of encoded data C represent blocks, while the columnsrepresent corresponding bytes of each of the drives.

Further, in case of a disk drive failure of one or more disks, thearithmetic operations are designed in such a fashion that for anystripe, the original data (and by extension, the check data) can bereconstructed from any combination of N data and check blocks from thecorresponding N+M data and check blocks that comprise the stripe. Thus,RAID provides both parallel processing (reading and writing the data instripes across multiple drives concurrently) and fault tolerance(regeneration of the original data even if as many as M of the drivesfail), at the computational cost of generating the check data any timenew data is written to disk, or changed data is written back to disk, aswell as the computational cost of reconstructing any lost original dataand regenerating any lost check data after a disk failure.

For example, for M=1 check drive, a single parity drive can function asthe check drive (i.e., a RAID4 system). Here, the arithmetic operationis bitwise exclusive OR of each of the N corresponding data bytes ineach data block of the stripe. In addition, as mentioned earlier, theassignment of parity blocks from different stripes to the same drive(i.e., RAID4) or different drives (i.e., RAID5) is arbitrary, but itdoes simplify the description and implementation to use a consistentassignment between stripes, so that will be assumed throughout. SinceM=1 reduces to the case of a single parity drive, it will further beassumed for simplicity that M≥2 throughout.

For such larger values of M, Galois field arithmetic is used tomanipulate the data, as described in more detail later. Galois fieldarithmetic, for Galois fields of powers-of-2 (such as 2^(P)) numbers ofelements, includes two fundamental operations: (1) addition (which isjust bitwise exclusive OR, as with the parity drive-only operations forM=1), and (2) multiplication. While Galois field (GF) addition istrivial on standard processors, GF multiplication is not. Accordingly, asignificant component of RAID performance for M≥2 is speeding up theperformance of GF multiplication, as will be discussed later. Forpurposes of description, GF addition will be represented by thesymbol+throughout while GF multiplication will be represented by thesymbol×throughout.

Briefly, in exemplary embodiments of the present invention, each of theM check drives holds linear combinations (over GF arithmetic) of the Ndata drives of original data, one linear combination (i.e., a GF sum ofN terms, where each term represents a byte of original data times acorresponding factor (using GF multiplication) for the respective datadrive) for each check drive, as applied to respective bytes in eachblock. One such linear combination can be a simple parity, i.e.,entirely GF addition (all factors equal 1), such as a GF sum of thefirst byte in each block of original data as described above.

The remaining M−1 linear combinations include more involved calculationsthat include the nontrivial GF multiplication operations (e.g.,performing a GF multiplication of the first byte in each block by acorresponding factor for the respective data drive, and then performinga GF sum of all these products). These linear combinations can berepresented by an (N+M)×N matrix (encoding matrix or informationdispersal matrix (IDM)) E of the different factors, one factor for eachcombination of (data or check) drive and data drive, with one row foreach of the N+M data and check drives and one column for each of the Ndata drives. The IDM E can also be represented as

$\begin{bmatrix}I_{N} \\H\end{bmatrix},$

where I_(N) represents the N×N identity matrix (i.e., the original(unencoded) data) and H represents the M×N matrix of factors for thecheck drives (where each of the M rows corresponds to one of the M checkdrives and each of the N columns corresponds to one of the N datadrives).

Thus,

${E = {\begin{bmatrix}I_{N} \\H\end{bmatrix} = \begin{bmatrix}1 & 0 & \ldots & 0 \\0 & 1 & \ldots & 0 \\\vdots & \vdots & \ddots & \vdots \\0 & 0 & \ldots & 1 \\H_{11} & H_{12} & \ldots & H_{1N} \\H_{21} & H_{22} & \ldots & H_{2N} \\\vdots & \vdots & \ddots & \vdots \\H_{M\; 1} & H_{M\; 2} & \ldots & H_{MN}\end{bmatrix}}},$

where H_(ij)=factor for check drive i and data drive j. Thus, the rowsof encoded data C represent blocks, while the columns representcorresponding bytes of each of the drives. In addition, check factors H,original data D, and check data J are related by the formula J=H×D (thatis, matrix multiplication), or

${\left\lbrack \begin{matrix}J_{11} & J_{12} & \ldots & J_{1L} \\J_{21} & J_{22} & \ldots & J_{2L} \\\vdots & \vdots & \ddots & \vdots \\J_{M\; 1} & J_{M\; 2} & \ldots & J_{ML}\end{matrix} \right\rbrack = {\left\lbrack \begin{matrix}H_{11} & H_{12} & \ldots & H_{1N} \\H_{21} & H_{22} & \ldots & H_{2N} \\\vdots & \vdots & \ddots & \vdots \\H_{M\; 1} & H_{M\; 2} & \ldots & H_{MN}\end{matrix} \right\rbrack \times \mspace{121mu} \left\lbrack \begin{matrix}D_{11} & D_{12} & \ldots & D_{1L} \\D_{21} & D_{22} & \ldots & D_{2L} \\\vdots & \vdots & \ddots & \vdots \\D_{N\; 1} & D_{N\; 2} & \ldots & D_{NL}\end{matrix} \right\rbrack}},$

where J₁₁=(H₁₁×D₁₁)+(H₁₂×D₂₁)+ . . . +(H_(1N)×D_(N1)),J₁₂=(H₁₁×D₁₂)+(H₁₂×D₂₂)+ . . . +(H_(1N)×D_(N2)),J₂₁=(H₂₁×D₁₁)+(H₂₂×D₂₁)+ . . . +(H_(2N)×D_(N1)), and in general,J_(ij)=(H_(i1)×D_(1f))+(H_(i2)×D_(2j))+ . . . +(H_(iN)×D_(Nj)) for 1≤i≤Mand 1≤j≤L.

Such an encoding matrix E is also referred to as an informationdispersal matrix (IDM). It should be noted that matrices such as checkdrive encoding matrix H and identity matrix I_(N) also representencoding matrices, in that they represent matrices of factors to producelinear combinations over GF arithmetic of the original data. Inpractice, the identity matrix I_(N) is trivial and may not need to beconstructed as part of the IDM E. Only the encoding matrix E, however,will be referred to as the IDM. Methods of building an encoding matrixsuch as IDM E or check drive encoding matrix H are discussed below. Infurther embodiments of the present invention (as discussed further inAppendix A), such (N+M)×N (or M×N) matrices can be trivially constructed(or simply indexed) from a master encoding matrix S, which is composedof (N_(max)+M_(max))×N_(max) (or M_(max)×N_(max)) bytes or elements,where N_(max)+M_(max)=256 (or some other power of two) and N≤N_(max) andM≤M_(max). For example, one such master encoding matrix S can include a127×127 element identity matrix on top (for up to N_(max)=127 datadrives), a row of 1's (for a parity drive), and a 128×127 elementencoding matrix on bottom (for up to M_(max)=129 check drives, includingthe parity drive), for a total of N_(max)+M_(max)=256 drives.

The original data, in turn, can be represented by an N×L matrix D ofbytes, each of the N rows representing the L bytes of a block of thecorresponding one of the N data drives. If C represents thecorresponding (N+M)×L matrix of encoded bytes (where each of the N+Mrows corresponds to one of the N+M data and check drives), then C can berepresented as

${{E \times D} = {{\begin{bmatrix}I_{N} \\H\end{bmatrix} \times D} = {\begin{bmatrix}{I_{N} \times D} \\{H \times D}\end{bmatrix} = \begin{bmatrix}D \\J\end{bmatrix}}}},$

where J=H×D is an M×L matrix of check data, with each of the M rowsrepresenting the L check bytes of the corresponding one of the M checkdrives. It should be noted that in the relationships such as C=E×D orJ=H×D, x represents matrix multiplication over the Galois field (i.e.,GF multiplication and GF addition being used to generate each of theentries in, for example, C or

In exemplary embodiments of the present invention, the first row of thecheck drive encoding matrix H (or the (N+1)^(th) row of the IDM E) canbe all 1's, representing the parity drive. For linear combinationsinvolving this row, the GF multiplication can be bypassed and replacedwith a GF sum of the corresponding bytes since the products are alltrivial products involving the identity element 1. Accordingly, inparity drive implementations, the check drive encoding matrix H can alsobe thought of as an (M−1)×N matrix of non-trivial factors (that is,factors intended to be used in GF multiplication and not just GFaddition).

Much of the RAID processing involves generating the check data when newor changed data is written to (or back to) disk. The other significantevent for RAID processing is when one or more of the drives fail (dataor check drives), or for whatever reason become unavailable. Assume thatin such a failure scenario, F data drives fail and G check drives fail,where F and G are nonnegative integers. If F=0, then only check drivesfailed and all of the original data D survived. In this case, the lostcheck data can be regenerated from the original data D.

Accordingly, assume at least one data drive fails, that is, F≥1, and letK=N−F represent the number of data drives that survive. K is also anonnegative integer. In addition, let X represent the surviving originaldata and Y represent the lost original data. That is, X is a K×L matrixcomposed of the K rows of the original data matrix D corresponding tothe K surviving data drives, while Y is an F×L matrix composed of the Frows of the original data matrix D corresponding to the F failed datadrives.

$\begin{bmatrix}X \\Y\end{bmatrix}\quad$

thus represents a permuted original data matrix D′ (that is, theoriginal data matrix D, only with the surviving original data X on topand the lost original data Y on bottom. It should be noted that once thelost original data Y is reconstructed, it can be combined with thesurviving original data X to restore the original data D, from which thecheck data for any of the failed check drives can be regenerated.

It should also be noted that M−G check drives survive. In order toreconstruct the lost original data Y, enough (that is, at least N) totaldrives must survive. Given that K=N−F data drives survive, and that M−Gcheck drives survive, it follows that (N−F)+(M−G)≥N must be true toreconstruct the lost original data Y. This is equivalent to F+G≤M (i.e.,no more than F+G drives fail), or F≤M−G (that is, the number of faileddata drives does not exceed the number of surviving check drives). Itwill therefore be assumed for simplicity that F≤M−G.

In the routines that follow, performance can be enhanced by prebuildinglists of the failed and surviving data and check drives (that is, fourseparate lists). This allows processing of the different sets ofsurviving and failed drives to be done more efficiently than existingsolutions, which use, for example, bit vectors that have to be examinedone bit at a time and often include large numbers of consecutive zeros(or ones) when ones (or zeros) are the bit values of interest.

FIG. 2 shows an exemplary method 300 for reconstructing lost data aftera failure of one or more drives according to an embodiment of thepresent invention.

While the recovery process is described in more detail later, briefly itconsists of two parts: (1) determining the solution matrix, and (2)reconstructing the lost data from the surviving data. Determining thesolution matrix can be done in three steps with the following algorithm(Algorithm 1), with reference to FIG. 2:

-   -   1. (Step 310 in FIG. 2) Reducing the (M+N)×N IDM E to an N×N        reduced encoding matrix T (also referred to as the transformed        IDM) including the K surviving data drive rows and any F of the        M−G surviving check drive rows (for instance, the first F        surviving check drive rows, as these will include the parity        drive if it survived; recall that F≤M−G was assumed). In        addition, the columns of the reduced encoding matrix T are        rearranged so that the K columns corresponding to the K        surviving data drives are on the left side of the matrix and the        F columns corresponding to the F failed drives are on the right        side of the matrix. (Step 320) These F surviving check drives        selected to rebuild the lost original data Y will henceforth be        referred to as “the F surviving check drives,” and their check        data W will be referred to as “the surviving check data,” even        though M−G check drives survived. It should be noted that W is        an F×L matrix composed of the F rows of the check data J        corresponding to the F surviving check drives. Further, the        surviving encoded data can be represented as a sub-matrix C′ of        the encoded data C. The surviving encoded data C′ is an N×L        matrix composed of the surviving original data X on top and the        surviving check data Won bottom, that is,

$C^{\prime} = {\begin{bmatrix}X \\W\end{bmatrix}.}$

-   -   2. (Step 330) Splitting the reduced encoding matrix T into four        sub-matrices (that are also encoding matrices): (i) a K×K        identity matrix I_(K) (corresponding to the K surviving data        drives) in the upper left, (ii) a K×F matrix O of zeros in the        upper right, (iii) an F×K encoding matrix A in the lower left        corresponding to the F surviving check drive rows and the K        surviving data drive columns, and (iv) an F×F encoding matrix B        in the lower right corresponding to the F surviving check drive        rows and the F failed data drive columns. Thus, the reduced        encoding matrix T can be represented as

$\begin{bmatrix}I_{K} & O \\A & B\end{bmatrix}.$

-   -   3. (Step 340) Calculating the inverse B⁻¹ of the F×F encoding        matrix B. As is shown in more detail in Appendix A, C′=T×D′, or

$\begin{bmatrix}X \\W\end{bmatrix} = {\begin{bmatrix}I_{K} & O \\A & B\end{bmatrix} \times \begin{bmatrix}X \\Y\end{bmatrix}{\quad,}}$

which is mathematically equivalent to W=A×X+B×Y. B⁻¹ is the solutionmatrix, and is itself an F×F encoding matrix. Calculating the solutionmatrix B⁻¹ thus allows the lost original data Y to be reconstructed fromthe encoding matrices A and B along with the surviving original data Xand the surviving check data W.

The F×K encoding matrix A represents the original encoding matrix E,only limited to the K surviving data drives and the F surviving checkdrives. That is, each of the F rows of A represents a different one ofthe F surviving check drives, while each of the K columns of Arepresents a different one of the K surviving data drives. Thus, Aprovides the encoding factors needed to encode the original data for thesurviving check drives, but only applied to the surviving data drives(that is, the surviving partial check data). Since the survivingoriginal data X is available, A can be used to generate this survivingpartial check data.

In similar fashion, the F×F encoding matrix B represents the originalencoding matrix E, only limited to the F surviving check drives and theF failed data drives. That is, the F rows of B correspond to the same Frows of A, while each of the F columns of B represents a different oneof the F failed data drives. Thus, B provides the encoding factorsneeded to encode the original data for the surviving check drives, butonly applied to the failed data drives (that is, the lost partial checkdata). Since the lost original data Y is not available, B cannot be usedto generate any of the lost partial check data. However, this lostpartial check data can be determined from A and the surviving check dataW. Since this lost partial check data represents the result of applyingB to the lost original data Y, B⁻¹ thus represents the necessary factorsto reconstruct the lost original data Y from the lost partial checkdata.

It should be noted that steps 1 and 2 in Algorithm 1 above are logical,in that encoding matrices A and B (or the reduced encoding matrix T, forthat matter) do not have to actually be constructed. Appropriateindexing of the IDM E (or the master encoding matrix S) can be used toobtain any of their entries. Step 3, however, is a matrix inversion overGF arithmetic and takes O(F³) operations, as discussed in more detaillater. Nonetheless, this is a significant improvement over existingsolutions, which require O(N³) operations, since the number of faileddata drives F is usually significantly less than the number of datadrives N in any practical situation.

(Step 350 in FIG. 2) Once the encoding matrix A and the solution matrixB⁻¹ are known, reconstructing the lost data from the surviving data(that is, the surviving original data X and the surviving check data W)can be accomplished in four steps using the following algorithm(Algorithm 2):

-   -   1. Use A and the surviving original data X (using matrix        multiplication) to generate the surviving check data (i.e.,        A×X), only limited to the K surviving data drives. Call this        limited check data the surviving partial check data.    -   2. Subtract this surviving partial check data from the surviving        check data W (using matrix subtraction, i.e., W−A×X, which is        just entry-by-entry GF subtraction, which is the same as GF        addition for this Galois field). This generates the surviving        check data, only this time limited to the F failed data drives.        Call this limited check data the lost partial check data.    -   3. Use the solution matrix B⁻¹ and the lost partial check data        (using matrix multiplication, i.e., B⁻¹×(W−A×X) to reconstruct        the lost original data Y. Call this the recovered original data        Y.    -   4. Use the corresponding rows of the IDM E (or master encoding        matrix 5) for each of the G failed check drives along with the        original data D, as reconstructed from the surviving and        recovered original data X and Y, to regenerate the lost check        data (using matrix multiplication).

As will be shown in more detail later, steps 1-3 together require O(F)operations times the amount of original data D to reconstruct the lostoriginal data Y for the F failed data drives (i.e., roughly 1 operationper failed data drive per byte of original data D), which isproportionally equivalent to the O(M) operations times the amount oforiginal data D needed to generate the check data J for the M checkdrives (i.e., roughly 1 operation per check drive per byte of originaldata D). In addition, this same equivalence extends to step 4, whichtakes O(G) operations times the amount of original data D needed toregenerate the lost check data for the G failed check drives (i.e.,roughly 1 operation per failed check drive per byte of original data D).In summary, the number of operations needed to reconstruct the lost datais O(F+G) times the amount of original data D (i.e., roughly 1 operationper failed drive (data or check) per byte of original data D). SinceF+G≤M, this means that the computational complexity of Algorithm 2(reconstructing the lost data from the surviving data) is no more thanthat of generating the check data J from the original data D.

As mentioned above, for exemplary purposes and ease of description, datais assumed to be organized in 8-bit bytes, each byte capable of takingon 2⁸=256 possible values. Such data can be manipulated in byte-sizeelements using GF arithmetic for a Galois field of size 2⁸=256 elements.It should also be noted that the same mathematical principles apply toany power-of-two 2^(P) number of elements, not just 256, as Galoisfields can be constructed for any integral power of a prime number.Since Galois fields are finite, and since GF operations never overflow,all results are the same size as the inputs, for example, 8 bits.

In a Galois field of a power-of-two number of elements, addition andsubtraction are the same operation, namely a bitwise exclusive OR (XOR)of the two operands. This is a very fast operation to perform on anycurrent processor. It can also be performed on multiple bytesconcurrently. Since the addition and subtraction operations take place,for example, on a byte-level basis, they can be done in parallel byusing, for instance, x86 architecture Streaming SIMD Extensions (SSE)instructions (SIMD stands for single instruction, multiple data, andrefers to performing the same instruction on different pieces of data,possibly concurrently), such as PXOR (Packed (bitwise) Exclusive OR).

SSE instructions can process, for example, 16-byte registers (XMMregisters), and are able to process such registers as though theycontain 16 separate one-byte operands (or 8 separate two-byte operands,or four separate four-byte operands, etc.) Accordingly, SSE instructionscan do byte-level processing 16 times faster than when compared toprocessing a byte at a time. Further, there are 16 XMM registers, sodedicating four such registers for operand storage allows the data to beprocessed in 64-byte increments, using the other 12 registers fortemporary storage. That is, individual operations can be performed asfour consecutive SSE operations on the four respective registers (64bytes), which can often allow such instructions to be efficientlypipelined and/or concurrently executed by the processor. In addition,the SSE instructions allows the same processing to be performed ondifferent such 64-byte increments of data in parallel using differentcores. Thus, using four separate cores can potentially speed up thisprocessing by an additional factor of 4 over using a single core.

For example, a parallel adder (Parallel Adder) can be built using the16-byte XMM registers and four consecutive PXOR instructions. Suchparallel processing (that is, 64 bytes at a time with only a fewmachine-level instructions) for GF arithmetic is a significantimprovement over doing the addition one byte at a time. Since the datais organized in blocks of any fixed number of bytes, such as 4096 bytes(4 kilobytes, or 4 KB) or 32,768 bytes (32 KB), a block can be composedof numerous such 64-byte chunks (e.g., 64 separate 64-byte chunks in 4KB, or 512 chunks in 32 KB).

Multiplication in a Galois field is not as straightforward. While muchof it is bitwise shifts and exclusive OR's (i.e., “additions”) that arevery fast operations, the numbers “wrap” in peculiar ways when they areshifted outside of their normal bounds (because the field has only afinite set of elements), which can slow down the calculations. This“wrapping” in the GF multiplication can be addressed in many ways. Forexample, the multiplication can be implemented serially (SerialMultiplier) as a loop iterating over the bits of one operand whileperforming the shifts, adds, and wraps on the other operand. Suchprocessing, however, takes several machine instructions per bit for 8separate bits. In other words, this technique requires dozens of machineinstructions per byte being multiplied. This is inefficient compared to,for example, the performance of the Parallel Adder described above.

For another approach (Serial Lookup Multiplier), multiplication tables(of all the possible products, or at least all the non-trivial products)can be pre-computed and built ahead of time. For example, a table of256×256=65,536 bytes can hold all the possible products of the twodifferent one-byte operands). However, such tables can force serializedaccess on what are only byte-level operations, and not take advantage ofwide (concurrent) data paths available on modern processors, such asthose used to implement the Parallel Adder above.

In still another approach (Parallel Multiplier), the GF multiplicationcan be done on multiple bytes at a time, since the same factor in theencoding matrix is multiplied with every element in a data block. Thus,the same factor can be multiplied with 64 consecutive data block bytesat a time. This is similar to the Parallel Adder described above, onlythere are several more operations needed to perform the operation. Whilethis can be implemented as a loop on each bit of the factor, asdescribed above, only performing the shifts, adds, and wraps on 64 bytesat a time, it can be more efficient to process the 256 possible factorsas a (C language) switch statement, with inline code for each of 256different combinations of two primitive GF operations: Multiply-by-2 andAdd. For example, GF multiplication by the factor 3 can be effected byfirst doing a Multiply-by-2 followed by an Add. Likewise, GFmultiplication by 4 is just a Multiply-by-2 followed by a Multiply-by-2while multiplication by 6 is a Multiply-by-2 followed by an Add and thenby another Multiply-by-2.

While this Add is identical to the Parallel Adder described above (e.g.,four consecutive PXOR instructions to process 64 separate bytes),Multiply-by-2 is not as straightforward. For example, Multiply-by-2 inGF arithmetic can be implemented across 64 bytes at a time in 4 XMMregisters via 4 consecutive PXOR instructions, 4 consecutive PCMPGTB(Packed Compare for Greater Than) instructions, 4 consecutive PADDB(Packed Add) instructions, 4 consecutive PAND (Bitwise AND)instructions, and 4 consecutive PXOR instructions. Though this takes 20machine instructions, the instructions are very fast and results in 64consecutive bytes of data at a time being multiplied by 2.

For 64 bytes of data, assuming a random factor between 0 and 255, thetotal overhead for the Parallel Multiplier is about 6 calls tomultiply-by-2 and about 3.5 calls to add, or about 6×20+3.5×4=134machine instructions, or a little over 2 machine instructions per byteof data. While this compares favorably with byte-level processing, it isstill possible to improve on this by building a parallel multiplier witha table lookup (Parallel Lookup Multiplier) using the PSHUFB (PackedShuffle Bytes) instruction and doing the GF multiplication in 4-bitnibbles (half bytes).

FIG. 3 shows an exemplary method 400 for performing a parallel lookupGalois field multiplication according to an embodiment of the presentinvention.

Referring to FIG. 3, in step 410, two lookup tables are built once: onelookup table for the low-order nibbles in each byte, and one lookuptable for the high-order nibbles in each byte. Each lookup tablecontains 256 sets (one for each possible factor) of the 16 possible GFproducts of that factor and the 16 possible nibble values. Each lookuptable is thus 256×16=4096 bytes, which is considerably smaller than the65,536 bytes needed to store a complete one-byte multiplication table.In addition, PSHUFB does 16 separate table lookups at once, each for onenibble, so 8 PSHUFB instructions can be used to do all the table lookupsfor 64 bytes (128 nibbles).

Next, in step 420, the Parallel Lookup Multiplier is initialized for thenext set of 64 bytes of operand data (such as original data or survivingoriginal data). In order to save loading this data from memory onsucceeding calls, the Parallel Lookup Multiplier dedicates fourregisters for this data, which are left intact upon exit of the ParallelLookup Multiplier. This allows the same data to be called with differentfactors (such as processing the same data for another check drive).

Next in step 430, to process these 64 bytes of operand data, theParallel Lookup Multiplier can be implemented with 2 MOVDQA (Move DoubleQuadword Aligned) instructions (from memory) to do the two table lookupsand 4 MOVDQA instructions (register to register) to initialize registers(such as the output registers). These are followed in steps 440 and 450by two nearly identical sets of 17 register-to-register instructions tocarry out the multiplication 32 bytes at a time. Each such set starts(in step 440) with 5 more MOVDQA instructions for furtherinitialization, followed by 2 PSRLW (Packed Shift Right Logical Word)instructions to realign the high-order nibbles for PSHUFB, and 4 PANDinstructions to clear the high-order nibbles for PSHUFB. That is, tworegisters of byte operands are converted into four registers of nibbleoperands. Then, in step 450, 4 PSHUFB instructions are used to do theparallel table lookups, and 2 PXOR instructions to add the results ofthe multiplication on the two nibbles to the output registers.

Thus, the Parallel Lookup Multiplier uses 40 machine instructions toperform the parallel multiplication on 64 separate bytes, which isconsiderably better than the average 134 instructions for the ParallelMultiplier above, and only 10 times as many instructions as needed forthe Parallel Adder. While some of the Parallel Lookup Multiplier'sinstructions are more complex than those of the Parallel Adder, much ofthis complexity can be concealed through the pipelined and/or concurrentexecution of numerous such contiguous instructions (accessing differentregisters) on modern pipelined processors. For example, in exemplaryimplementations, the Parallel Lookup Multiplier has been timed at about15 CPU clock cycles per 64 bytes processed per CPU core (about 0.36clock cycles per instruction). In addition, the code footprint ispractically nonexistent for the Parallel Lookup Multiplier (40instructions) compared to that of the Parallel Multiplier (about 34,300instructions), even when factoring the 8 KB needed for the two lookuptables in the Parallel Lookup Multiplier.

In addition, embodiments of the Parallel Lookup Multiplier can be passed64 bytes of operand data (such as the next 64 bytes of survivingoriginal data X to be processed) in four consecutive registers, whosecontents can be preserved upon exiting the Parallel Lookup Multiplier(and all in the same 40 machine instructions) such that the ParallelLookup Multiplier can be invoked again on the same 64 bytes of datawithout having to access main memory to reload the data. Through such aprotocol, memory accesses can be minimized (or significantly reduced)for accessing the original data D during check data generation or thesurviving original data X during lost data reconstruction.

Further embodiments of the present invention are directed towardssequencing this parallel multiplication (and other GF) operations. Whilethe Parallel Lookup Multiplier processes a GF multiplication of 64 bytesof contiguous data times a specified factor, the calls to the ParallelLookup Multiplier should be appropriately sequenced to provide efficientprocessing. One such sequencer (Sequencer 1), for example, can generatethe check data J from the original data D, and is described further withrespect to FIG. 4.

The parity drive does not need GF multiplication. The check data for theparity drive can be obtained, for example, by adding corresponding64-byte chunks for each of the data drives to perform the parityoperation. The Parallel Adder can do this using 4 instructions for every64 bytes of data for each of the N data drives, or N/16 instructions perbyte.

The M−1 non-parity check drives can invoke the Parallel LookupMultiplier on each 64-byte chunk, using the appropriate factor for theparticular combination of data drive and check drive. One considerationis how to handle the data access. Two possible ways are:

-   -   1) “column-by-column,” i.e., 64 bytes for one data drive,        followed by the next 64 bytes for that data drive, etc., and        adding the products to the running total in memory (using the        Parallel Adder) before moving onto the next row (data drive);        and    -   2) “row-by-row,” i.e., 64 bytes for one data drive, followed by        the corresponding 64 bytes for the next data drive, etc., and        keeping a running total using the Parallel Adder, then moving        onto the next set of 64-byte chunks.

Column-by-column can be thought of as “constant factor, varying data,”in that the (GF multiplication) factor usually remains the same betweeniterations while the (64-byte) data changes with each iteration.Conversely, row-by-row can be thought of as “constant data, varyingfactor,” in that the data usually remains the same between iterationswhile the factor changes with each iteration.

Another consideration is how to handle the check drives. Two possibleways are:

-   -   a) one at a time, i.e., generate all the check data for one        check drive before moving onto the next check drive; and    -   b) all at once, i.e., for each 64-byte chunk of original data,        do all of the processing for each of the check drives before        moving onto the next chunk of original data.

While each of these techniques performs the same basic operations (e.g.,40 instructions for every 64 bytes of data for each of the N data drivesand M−1 non-parity check drives, or 5N(M−1)/8 instructions per byte forthe Parallel Lookup Multiplier), empirical results show that combination(2)(b), that is, row-by-row data access on all of the check drivesbetween data accesses performs best with the Parallel Lookup Multiplier.One reason may be that such an approach appears to minimize the numberof memory accesses (namely, one) to each chunk of the original data D togenerate the check data J. This embodiment of Sequencer 1 is describedin more detail with reference to FIG. 4.

FIG. 4 shows an exemplary method 500 for sequencing the Parallel LookupMultiplier to perform the check data generation according to anembodiment of the present invention.

Referring to FIG. 4, in step 510, the Sequencer 1 is called. Sequencer 1is called to process multiple 64-byte chunks of data for each of theblocks across a stripe of data. For instance, Sequencer 1 could becalled to process 512 bytes from each block. If, for example, the blocksize L is 4096 bytes, then it would take eight such calls to Sequencer 1to process the entire stripe. The other such seven calls to Sequencer 1could be to different processing cores, for instance, to carry out thecheck data generation in parallel. The number of 64-byte chunks toprocess at a time could depend on factors such as cache dimensions,input/output data structure sizes, etc.

In step 520, the outer loop processes the next 64-byte chunk of data foreach of the drives. In order to minimize the number of accesses of eachdata drive's 64-byte chunk of data from memory, the data is loaded onlyonce and preserved across calls to the Parallel Lookup Multiplier. Thefirst data drive is handled specially since the check data has to beinitialized for each check drive. Using the first data drive toinitialize the check data saves doing the initialization as a separatestep followed by updating it with the first data drive's data. Inaddition to the first data drive, the first check drive is also handledspecially since it is a parity drive, so its check data can beinitialized to the first data drive's data directly without needing theParallel Lookup Multiplier.

In step 530, the first middle loop is called, in which the remainder ofthe check drives (that is, the non-parity check drives) have their checkdata initialized by the first data drive's data. In this case, there isa corresponding factor (that varies with each check drive) that needs tobe multiplied with each of the first data drive's data bytes. This ishandled by calling the Parallel Lookup Multiplier for each non-paritycheck drive.

In step 540, the second middle loop is called, which processes the otherdata drives' corresponding 64-byte chunks of data. As with the firstdata drive, each of the other data drives is processed separately,loading the respective 64 bytes of data into four registers (preservedacross calls to the Parallel Lookup Multiplier). In addition, since thefirst check drive is the parity drive, its check data can be updated bydirectly adding these 64 bytes to it (using the Parallel Adder) beforehandling the non-parity check drives.

In step 550, the inner loop is called for the next data drive. In theinner loop (as with the first middle loop), each of the non-parity checkdrives is associated with a corresponding factor for the particular datadrive. The factor is multiplied with each of the next data drive's databytes using the Parallel Lookup Multiplier, and the results added to thecheck drive's check data.

Another such sequencer (Sequencer 2) can be used to reconstruct the lostdata from the surviving data (using Algorithm 2). While the samecolumn-by-column and row-by-row data access approaches are possible, aswell as the same choices for handling the check drives, Algorithm 2 addsanother dimension of complexity because of the four separate steps andwhether to: (i) do the steps completely serially or (ii) do some of thesteps concurrently on the same data. For example, step 1 (survivingcheck data generation) and step 4 (lost check data regeneration) can bedone concurrently on the same data to reduce or minimize the number ofsurviving original data accesses from memory.

Empirical results show that method (2)(b)(ii), that is, row-by-row dataaccess on all of the check drives and for both surviving check datageneration and lost check data regeneration between data accessesperforms best with the Parallel Lookup Multiplier when reconstructinglost data using Algorithm 2. Again, this may be due to the apparentminimization of the number of memory accesses (namely, one) of eachchunk of surviving original data X to reconstruct the lost data and theabsence of memory accesses of reconstructed lost original data Y whenregenerating the lost check data. This embodiment of Sequencer 1 isdescribed in more detail with reference to FIGS. 5-7.

FIGS. 5-7 show an exemplary method 600 for sequencing the ParallelLookup Multiplier to perform the lost data reconstruction according toan embodiment of the present invention.

Referring to FIG. 5, in step 610, the Sequencer 2 is called. Sequencer 2has many similarities with the embodiment of Sequencer 1 illustrated inFIG. 4. For instance, Sequencer 2 processes the data drive data in64-byte chunks like Sequencer 1. Sequencer 2 is more complex, however,in that only some of the data drive data is surviving; the rest has tobe reconstructed. In addition, lost check data needs to be regenerated.Like Sequencer 1, Sequencer 2 does these operations in such a way as tominimize memory accesses of the data drive data (by loading the dataonce and calling the Parallel Lookup Multiplier multiple times). Assumefor ease of description that there is at least one surviving data drive;the case of no surviving data drives is handled a little differently,but not significantly different. In addition, recall from above that thedriving formula behind data reconstruction is Y=B⁻¹×(W−A×x), where Y isthe lost original data, B⁻¹ is the solution matrix, W is the survivingcheck data, A is the partial check data encoding matrix (for thesurviving check drives and the surviving data drives), and X is thesurviving original data.

In step 620, the outer loop processes the next 64-byte chunk of data foreach of the drives. Like Sequencer 1, the first surviving data drive isagain handled specially since the partial check data A×X has to beinitialized for each surviving check drive.

In step 630, the first middle loop is called, in which the partial checkdata A×X is initialized for each surviving check drive based on thefirst surviving data drive's 64 bytes of data. In this case, theParallel Lookup Multiplier is called for each surviving check drive withthe corresponding factor (from A) for the first surviving data drive.

In step 640, the second middle loop is called, in which the lost checkdata is initialized for each failed check drive. Using the same 64 bytesof the first surviving data drive (preserved across the calls toParallel Lookup Multiplier in step 630), the Parallel Lookup Multiplieris again called, this time to initialize each of the failed checkdrive's check data to the corresponding component from the firstsurviving data drive. This completes the computations involving thefirst surviving data drive's 64 bytes of data, which were fetched withone access from main memory and preserved in the same four registersacross steps 630 and 640.

Continuing with FIG. 6, in step 650, the third middle loop is called,which processes the other surviving data drives' corresponding 64-bytechunks of data. As with the first surviving data drive, each of theother surviving data drives is processed separately, loading therespective 64 bytes of data into four registers (preserved across callsto the Parallel Lookup Multiplier).

In step 660, the first inner loop is called, in which the partial checkdata A×X is updated for each surviving check drive based on the nextsurviving data drive's 64 bytes of data. In this case, the ParallelLookup Multiplier is called for each surviving check drive with thecorresponding factor (from A) for the next surviving data drive.

In step 670, the second inner loop is called, in which the lost checkdata is updated for each failed check drive. Using the same 64 bytes ofthe next surviving data drive (preserved across the calls to ParallelLookup Multiplier in step 660), the Parallel Lookup Multiplier is againcalled, this time to update each of the failed check drive's check databy the corresponding component from the next surviving data drive. Thiscompletes the computations involving the next surviving data drive's 64bytes of data, which were fetched with one access from main memory andpreserved in the same four registers across steps 660 and 670.

Next, in step 680, the computation of the partial check data A×X iscomplete, so the surviving check data W is added to this result (recallthat W−A×X is equivalent to W+A×X in binary Galois Field arithmetic).This is done by the fourth middle loop, which for each surviving checkdrive adds the corresponding 64-byte component of surviving check data Wto the (surviving) partial check data A×X (using the Parallel Adder) toproduce the (lost) partial check data W−A×X.

Continuing with FIG. 7, in step 690, the fifth middle loop is called,which performs the two dimensional matrix multiplication B⁻¹×(W−A×X) toproduce the lost original data Y. The calculation is performed one rowat a time, for a total of F rows, initializing the row to the first termof the corresponding linear combination of the solution matrix B⁻¹ andthe lost partial check data W−A×X (using the Parallel LookupMultiplier).

In step 700, the third inner loop is called, which completes theremaining F−1 terms of the corresponding linear combination (using theParallel Lookup Multiplier on each term) from the fifth middle loop instep 690 and updates the running calculation (using the Parallel Adder)of the next row of B⁻¹×(W−A×X). This completes the next row (andreconstructs the corresponding failed data drive's lost data) of lostoriginal data Y, which can then be stored at an appropriate location.

In step 710, the fourth inner loop is called, in which the lost checkdata is updated for each failed check drive by the newly reconstructedlost data for the next failed data drive. Using the same 64 bytes of thenext reconstructed lost data (preserved across calls to the ParallelLookup Multiplier), the Parallel Lookup Multiplier is called to updateeach of the failed check drives' check data by the correspondingcomponent from the next failed data drive. This completes thecomputations involving the next failed data drive's 64 bytes ofreconstructed data, which were performed as soon as the data wasreconstructed and without being stored and retrieved from main memory.

Finally, in step 720, the sixth middle loop is called. The lost checkdata has been regenerated, so in this step, the newly regenerated checkdata is stored at an appropriate location (if desired).

Aspects of the present invention can be also realized in otherenvironments, such as two-byte quantities, each such two-byte quantitycapable of taking on 2¹⁶=65,536 possible values, by using similarconstructs (scaled accordingly) to those presented here. Such extensionswould be readily apparent to one of ordinary skill in the art, so theirdetails will be omitted for brevity of description.

Exemplary techniques and methods for doing the Galois field manipulationand other mathematics behind RAID error correcting codes are describedin Appendix A, which contains a paper “Information Dispersal Matricesfor RAID Error Correcting Codes” prepared for the present application.

Multi-Core Considerations

What follows is an exemplary embodiment for optimizing or improving theperformance of multi-core architecture systems when implementing thedescribed erasure coding system routines. In multi-core architecturesystems, each processor die is divided into multiple CPU cores, eachwith their own local caches, together with a memory (bus) interface andpossible on-die cache to interface with a shared memory with otherprocessor dies.

FIG. 8 illustrates a multi-core architecture system 100 having twoprocessor dies 110 (namely, Die 0 and Die 1).

Referring to FIG. 8, each die 110 includes four central processing units(CPUs or cores) 120 each having a local level 1 (L1) cache. Each core120 may have separate functional units, for example, an x86 executionunit (for traditional instructions) and a SSE execution unit (forsoftware designed for the newer SSE instruction set). An exampleapplication of these function units is that the x86 execution unit canbe used for the RAID control logic software while the SSE execution unitcan be used for the GF operation software. Each die 110 also has a level2 (L2) cache/memory bus interface 130 shared between the four cores 120.Main memory 140, in turn, is shared between the two dies 110, and isconnected to the input/output (I/O) controllers 150 that access externaldevices such as disk drives or other non-volatile storage devices viainterfaces such as Peripheral Component Interconnect (PCI).

Redundant array of independent disks (RAID) controller processing can bedescribed as a series of states or functions. These states may include:(1) Command Processing, to validate and schedule a host request (forexample, to load or store data from disk storage); (2) CommandTranslation and Submission, to translate the host request into multipledisk requests and to pass the requests to the physical disks; (3) ErrorCorrection, to generate check data and reconstruct lost data when somedisks are not functioning correctly; and (4) Request Completion, to movedata from internal buffers to requestor buffers. Note that the finalstate, Request Completion, may only be needed for a RAID controller thatsupports caching, and can be avoided in a cacheless design.

Parallelism is achieved in the embodiment of FIG. 8 by assigningdifferent cores 120 to different tasks. For example, some of the cores120 can be “command cores,” that is, assigned to the I/O operations,which includes reading and storing the data and check bytes to and frommemory 140 and the disk drives via the I/O interface 150. Others of thecores 120 can be “data cores,” and assigned to the GF operations, thatis, generating the check data from the original data, reconstructing thelost data from the surviving data, etc., including the Parallel LookupMultiplier and the sequencers described above. For example, in exemplaryembodiments, a scheduler can be used to divide the original data D intocorresponding portions of each block, which can then be processedindependently by different cores 120 for applications such as check datageneration and lost data reconstruction.

One of the benefits of this data core/command core subdivision ofprocessing is ensuring that different code will be executed in differentcores 120 (that is, command code in command cores, and data code in datacores). This improves the performance of the associated L1 cache in eachcore 120, and avoids the “pollution” of these caches with code that isless frequently executed. In addition, empirical results show that thedies 110 perform best when only one core 120 on each die 110 does the GFoperations (i.e., Sequencer 1 or Sequencer 2, with corresponding callsto Parallel Lookup Multiplier) and the other cores 120 do the I/Ooperations. This helps localize the Parallel Lookup Multiplier code andassociated data to a single core 120 and not compete with other cores120, while allowing the other cores 120 to keep the data moving betweenmemory 140 and the disk drives via the I/O interface 150.

Embodiments of the present invention yield scalable, high performanceRAID systems capable of outperforming other systems, and at much lowercost, due to the use of high volume commodity components that areleveraged to achieve the result. This combination can be achieved byutilizing the mathematical techniques and code optimizations describedelsewhere in this application with careful placement of the resultingcode on specific processing cores. Embodiments can also be implementedon fewer resources, such as single-core dies and/or single-die systems,with decreased parallelism and performance optimization.

The process of subdividing and assigning individual cores 120 and/ordies 110 to inherently parallelizable tasks will result in a performancebenefit. For example, on a Linux system, software may be organized into“threads,” and threads may be assigned to specific CPUs and memorysystems via the kthread_bind function when the thread is created.Creating separate threads to process the GF arithmetic allows parallelcomputations to take place, which multiplies the performance of thesystem.

Further, creating multiple threads for command processing allows forfully overlapped execution of the command processing states. One way toaccomplish this is to number each command, then use the arithmetic MODfunction (% in C language) to choose a separate thread for each command.Another technique is to subdivide the data processing portion of eachcommand into multiple components, and assign each component to aseparate thread.

FIG. 9 shows an exemplary disk drive configuration 200 according to anembodiment of the present invention.

Referring to FIG. 9, eight disks are shown, though this number can varyin other embodiments. The disks are divided into three types: datadrives 210, parity drive 220, and check drives 230. The eight disksbreak down as three data drives 210, one parity drive 220, and fourcheck drives 230 in the embodiment of FIG. 9.

Each of the data drives 210 is used to hold a portion of data. The datais distributed uniformly across the data drives 210 in stripes, such as192 KB stripes. For example, the data for an application can be brokenup into stripes of 192 KB, and each of the stripes in turn broken upinto three 64 KB blocks, each of the three blocks being written to adifferent one of the three data drives 210.

The parity drive 220 is a special type of check drive in that theencoding of its data is a simple summation (recall that this isexclusive OR in binary GF arithmetic) of the corresponding bytes of eachof the three data drives 210. That is, check data generation (Sequencer1) or regeneration (Sequencer 2) can be performed for the parity drive220 using the Parallel Adder (and not the Parallel Lookup Multiplier).Accordingly, the check data for the parity drive 220 is relativelystraightforward to build. Likewise, when one of the data drives 210 nolonger functions correctly, the parity drive 220 can be used toreconstruct the lost data by adding (same as subtracting in binary GFarithmetic) the corresponding bytes from each of the two remaining datadrives 210. Thus, a single drive failure of one of the data drives 210is very straightforward to handle when the parity drive 220 is available(no Parallel Lookup Multiplier). Accordingly, the parity drive 220 canreplace much of the GF multiplication operations with GF addition forboth check data generation and lost data reconstruction.

Each of the check drives 230 contains a linear combination of thecorresponding bytes of each of the data drives 210. The linearcombination is different for each check drive 230, but in general isrepresented by a summation of different multiples of each of thecorresponding bytes of the data drives 210 (again, all arithmetic beingGF arithmetic). For example, for the first check drive 230, each of thebytes of the first data drive 210 could be multiplied by 4, each of thebytes of the second data drive 210 by 3, and each of the bytes of thethird data drive 210 by 6, then the corresponding products for each ofthe corresponding bytes could be added to produce the first check drivedata. Similar linear combinations could be used to produce the checkdrive data for the other check drives 230. The specifics of whichmultiples for which check drive are explained in Appendix A.

With the addition of the parity drive 220 and check drives 230, eightdrives are used in the RAID system 200 of FIG. 9. Accordingly, each 192KB of original data is stored as 512 KB (i.e., eight blocks of 64 KB) of(original plus check) data. Such a system 200, however, is capable ofrecovering all of the original data provided any three of these eightdrives survive.

That is, the system 200 can withstand a concurrent failure of up to anyfive drives and still preserve all of the original data.

Exemplary Routines to Implement an Embodiment

The error correcting code (ECC) portion of an exemplary embodiment ofthe present invention may be written in software as, for example, fourfunctions, which could be named as ECCInitialize, ECCSolve, ECCGenerate,and ECCRegenerate. The main functions that perform work are ECCGenerateand ECCRegenerate. ECCGenerate generates check codes for data that areused to recover data when a drive suffers an outage (that is,ECCGenerate generates the check data J from the original data D usingSequencer 1). ECCRegenerate uses these check codes and the remainingdata to recover data after such an outage (that is, ECCRegenerate usesthe surviving check data W, the surviving original data X, and Sequencer2 to reconstruct the lost original data Y while also regenerating any ofthe lost check data). Prior to calling either of these functions,ECCSolve is called to compute the constants used for a particularconfiguration of data drives, check drives, and failed drives (forexample, ECCSolve builds the solution matrix B⁻¹ together with the listsof surviving and failed data and check drives). Prior to callingECCSolve, ECCInitialize is called to generate constant tables used byall of the other functions (for example, ECCInitialize builds the IDM Eand the two lookup tables for the Parallel Lookup Multiplier).

ECCInitialize

The function ECCInitialize creates constant tables that are used by allsubsequent functions. It is called once at program initialization time.By copying or precomputing these values up front, these constant tablescan be used to replace more time-consuming operations with simple tablelook-ups (such as for the Parallel Lookup Multiplier). For example, fourtables useful for speeding up the GF arithmetic include:

1. mvct—an array of constants used to perform GF multiplication with thePSHUFB instruction that operates on SSE registers (that is, the ParallelLookup Multiplier).

2. mast—contains the master encoding matrix S (or the InformationDispersal Matrix (IDM) E, as described in Appendix A), or at least thenontrivial portion, such as the check drive encoding matrix H

3. mul_tab—contains the results of all possible GF multiplicationoperations of any two operands (for example, 256×256=65,536 bytes forall of the possible products of two different one-byte quantities)

4. div_tab—contains the results of all possible GF division operationsof any two operands (can be similar in size to mul_tab)

ECC Solve

The function ECCSolve creates constant tables that are used to compute asolution for a particular configuration of data drives, check drives,and failed drives. It is called prior to using the functions ECCGenerateor ECCRegenerate. It allows the user to identify a particular case offailure by describing the logical configuration of data drives, checkdrives, and failed drives. It returns the constants, tables, and listsused to either generate check codes or regenerate data. For example, itcan return the matrix B that needs to be inverted as well as theinverted matrix B⁻¹ (i.e., the solution matrix).

ECCGenerate

The function ECCGenerate is used to generate check codes (that is, thecheck data matrix J) for a particular configuration of data drives andcheck drives, using Sequencer 1 and the Parallel Lookup Multiplier asdescribed above. Prior to calling ECCGenerate, ECCSolve is called tocompute the appropriate constants for the particular configuration ofdata drives and check drives, as well as the solution matrix B⁻¹.

ECCRegenerate

The function ECCRegenerate is used to regenerate data vectors and checkcode vectors for a particular configuration of data drives and checkdrives (that is, reconstructing the original data matrix D from thesurviving data matrix X and the surviving check matrix W, as well asregenerating the lost check data from the restored original data), thistime using Sequencer 2 and the Parallel Lookup Multiplier as describedabove. Prior to calling ECCRegenerate, ECCSolve is called to compute theappropriate constants for the particular configuration of data drives,check drives, and failed drives, as well as the solution matrix B⁻¹.

Exemplary Implementation Details

As discussed in Appendix A, there are two significant sources ofcomputational overhead in erasure code processing (such as an erasurecoding system used in RAID processing): the computation of the solutionmatrix B⁻¹ for a given failure scenario, and the byte-level processingof encoding the check data J and reconstructing the lost data after alost packet (e.g., data drive failure). By reducing the solution matrixB⁻¹ to a matrix inversion of a F×F matrix, where F is the number of lostpackets (e.g., failed drives), that portion of the computationaloverhead is for all intents and purposes negligible compared to themegabytes (MB), gigabytes (GB), and possibly terabytes (TB) of data thatneeds to be encoded into check data or reconstructed from the survivingoriginal and check data. Accordingly, the remainder of this section willbe devoted to the byte-level encoding and regenerating processing.

As already mentioned, certain practical simplifications can be assumedfor most implementations. By using a Galois field of 256 entries,byte-level processing can be used for all of the GF arithmetic. Usingthe master encoding matrix S described in Appendix A, any combination ofup to 127 data drives, 1 parity drive, and 128 check drives can besupported with such a Galois field. While, in general, any combinationof data drives and check drives that adds up to 256 total drives ispossible, not all combinations provide a parity drive when computeddirectly. Using the master encoding matrix S, on the other hand, allowsall such combinations (including a parity drive) to be built (or simplyindexed) from the same such matrix. That is, the appropriate sub-matrix(including the parity drive) can be used for configurations of less thanthe maximum number of drives.

In addition, using the master encoding matrix S permits further datadrives and/or check drives can be added without requiring therecomputing of the IDM E (unlike other proposed solutions, whichrecompute E for every change of N or M). Rather, additional indexing ofrows and/or columns of the master encoding matrix S will suffice. Asdiscussed above, the use of the parity drive can eliminate orsignificantly reduce the somewhat complex GF multiplication operationsassociated with the other check drives and replaces them with simple GFaddition (bitwise exclusive OR in binary Galois fields) operations. Itshould be noted that master encoding matrices with the above propertiesare possible for any power-of-two number of drives 2^(P)=N_(max)+M_(max)where the maximum number of data drives N_(max) is one less than a powerof two (e.g., N_(max)=127 or 63) and the maximum number of check drivesM_(max) (including the parity drive) is 2^(P)−N_(max).

As discussed earlier, in an exemplary embodiment of the presentinvention, a modern x86 architecture is used (being readily availableand inexpensive). In particular, this architecture supports 16 XMMregisters and the SSE instructions. Each XMM register is 128 bits and isavailable for special purpose processing with the SSE instructions. Eachof these XMM registers holds 16 bytes (8-bit), so four such registerscan be used to store 64 bytes of data. Thus, by using SSE instructions(some of which work on different operand sizes, for example, treatingeach of the XMM registers as containing 16 one-byte operands), 64 bytesof data can be operated at a time using four consecutive SSEinstructions (e.g., fetching from memory, storing into memory, zeroing,adding, multiplying), the remaining registers being used forintermediate results and temporary storage. With such an architecture,several routines are useful for optimizing the byte-level performance,including the Parallel Lookup Multiplier, Sequencer 1, and Sequencer 2discussed above.

While the above description contains many specific embodiments of theinvention, these should not be construed as limitations on the scope ofthe invention, but rather as examples of specific embodiments thereof.Accordingly, the scope of the invention should be determined not by theembodiments illustrated, but by the appended claims and theirequivalents.

Glossary of Some Variables A encoding matrix (F × K), sub-matrix of T Bencoding matrix (F × F) , sub-matrix of T B⁻¹ solution matrix (F × F) C${{encoded}\mspace{14mu} {data}\mspace{14mu} {matrix}\mspace{14mu} \left( {\left( {N + M} \right) \times L} \right)} = {\quad\begin{bmatrix}D \\J\end{bmatrix}}$ C′${{surviving}\mspace{14mu} {encoded}\mspace{14mu} {data}\mspace{14mu} {matrix}\mspace{14mu} \left( {N \times L} \right)} = {\quad\begin{bmatrix}X \\W\end{bmatrix}}$ D original data matrix (N × L) D′${permuted}\mspace{14mu} {original}\mspace{14mu} {data}\mspace{14mu} {matrix}\mspace{14mu} \left( {N \times L} \right){\quad{= \begin{bmatrix}X \\Y\end{bmatrix}}}$ E${information}\mspace{14mu} {dispersal}\mspace{14mu} {matrix}\mspace{14mu} ({IDM})\left( {\left( {N + M} \right) \times N} \right){\quad{= \begin{bmatrix}I_{N} \\H\end{bmatrix}}}$ F number of failed data drives G number of failed checkdrives H check drive encoding matrix (M × N) I identity matrix (I_(K) =K × K identity matrix, I_(N) = N × N identity matrix) J encoded checkdata matrix (M × L) K number of surviving data drives = N − F L datablock size (elements or bytes) M number of check drives M_(max) maximumvalue of M N number of data drives N_(max) maximum value of N O zeromatrix (K × F), sub-matrix of T S master encoding matrix ((M_(max) +N_(max)) × N_(max)) T${{transformed}\mspace{14mu} {IDM}\mspace{14mu} \left( {N \times N} \right)} = {\quad\begin{bmatrix}I_{K} & O \\A & B\end{bmatrix}}$ W surviving check data matrix (F × L) X survivingoriginal data matrix (K × L) Y lost original data matrix (F × L)

What is claimed is:
 1. A system for accelerated error-correcting code (ECC) processing comprising: a processing core for executing computer instructions and accessing data from a main memory; and a non-volatile storage medium for storing the computer instructions, wherein the processing core, the storage medium, and the computer instructions are configured to implement an erasure coding system comprising: a data matrix for holding original data in the main memory; a check matrix for holding check data in the main memory; an encoding matrix for holding first factors in the main memory, the first factors being for encoding the original data into the check data; and a thread for executing on the processing core and comprising: a parallel multiplier for concurrently multiplying multiple data entries of a matrix by a single factor; and a first sequencer for ordering operations through the data matrix and the encoding matrix using the parallel multiplier to generate the check data. 